#ifndef PACKETASSEMBLER_HPP
#define PACKETASSEMBLER_HPP

#include <boost/cstdint.hpp>
#include <boost/utility.hpp>

namespace google {
namespace protobuf {
class Message;
}
}

namespace kieper {
class PacketHeader;
class PacketAssembler : private boost::noncopyable {
public:
    PacketAssembler();
    ~PacketAssembler();
    PacketHeader makePacketHeader(const ::google::protobuf::Message* message,
      uint16_t messageType);

    /**
     *
     * @return total size of created packet
     */
    size_t makePacket(unsigned char* packetBuffer, 
      const PacketHeader* packetHeader,
      const ::google::protobuf::Message* message);

   uint16_t protocolVersion() const;
protected:
private:
    static const uint16_t PROTOCOL_VERSION = 1;
    uint32_t nextPacketId();
    uint32_t nextPacketId_;
};
}

#endif
